<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .container {
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
      }
      .list {
        background-color: skyblue;
        height: 100px;
        margin: 10px;
      } /* 使用伪元素辅助左对齐 */
      .container::after {
        content: "";
        flex: auto;
        /* 或者flex: 1 */
      }
    </style>
  </head>
  <body>
    <h3>
      有时候,没一个 flex 子项的宽度都是不固定的. 我们如果实现最后一行左对齐呢?
    </h3>
    <p style="color: red">创建伪元素, 并设置flex:auto或flex:1</p>
    <div class="container">
      <div style="width: 300px" class="list"></div>
      <div style="width: 400px" class="list"></div>
      <div style="width: 200px" class="list"></div>
      <div style="width: 600px" class="list"></div>
      <div style="width: 400px" class="list"></div>
      <div style="width: 200px" class="list"></div>
      <div style="width: 150px" class="list"></div>
    </div>
  </body>
</html>
